<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>#{$sys.title}#</title>
    <meta name="keywords" content="山东探越">
    <meta name="description" content="山东探越">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <link rel="shortcut icon" href="http://video.sdtanyue.com/png/favicon.png" type="image/vnd.microsoft.icon">
    <link href="#{$smarty.const.APP}#/View/template/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="#{$smarty.const.APP}#/View/template/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="#{$smarty.const.APP}#/View/template/css/animate.css" rel="stylesheet">
    <link href="#{$smarty.const.APP}#/View/template/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="#{$smarty.const.APP}#/View/template/css/plugins/toastr/toastr.min.css" rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close"><i class="fa fa-times-circle"></i></div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">
                        <div>
                            <a href="#{$smarty.const.ACT}#/sysmanage/Index/index/" class="J_menuItem">
                                <span class="clear">
                                    <span class="block m-t-xs" style="font-size:20px;">
                                        <img src="#{$smarty.const.APP}#/View/template/img/logo1.png" height="31">
                                    </span>
                                </span>
                            </a>
                        </div>
                        <div class="logo-element">
                            <img src="#{$smarty.const.APP}#/View/template/img/logo.png" width="30" height="30">
                        </div>
                    </li>
                    <li class="line dk"></li>
                    #{foreach from=$menu key=k item=v1}#
                    <!--显示主模块-->
                    <li><a href="javascript:void(0)"><i class="fa fa-#{$v1.url}#"></i> <span
                                class="nav-label">#{$v1.name}# </span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            #{foreach from=$v1.parentID key=k item=v2}#
                            #{if $v2.parentID neq null }#
                            <li><a class="J_menuItem" href="javascript:void(0)">#{$v2.name}#<span
                                        class="fa arrow"></span></a>
                                <ul class="nav nav-third-level">
                                    #{foreach from=$v2.parentID key=k item=v3}#
                                    <li><a class="J_menuItem" href="#{$smarty.const.ACT}##{$v3.url}#">#{$v3.name}#</a>
                                    </li>
                                    #{/foreach}#
                                </ul>
                            </li>
                            #{else}#
                            <li><a class="J_menuItem" href="#{$smarty.const.ACT}##{$v2.url}#">#{$v2.name}#</a> #{/if}#
                                #{/foreach}#
                        </ul>
                    </li>
                    #{/foreach}#
                </ul>
            </div>
        </nav>
        <!--左侧导航结束-->
        <!--右侧部分开始-->
        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header">
                        <a class="navbar-minimalize minimalize-styl-2 btn btn-info " href="#">
                            <i class="fa fa-bars"></i>
                        </a>
                    </div>
                    <!-- <div class="navbar-module">
                        <a href="http://oa.07fly.com/" target="_blank" title="07FLY-CRM开源系统V1版本">V1版本</a>
                        <a href="http://erp.07fly.com/" target="_blank" title="07FLY-CRM开源系统V2版本">V2版本</a>
                        <a href="http://erp.07fly.top/" target="_blank" title="07FLY-ERP企业管理系统">S1版本</a>
                        <a href="http://djt.07fly.top/" target="_blank" title="旅行社ERP管理软件地接版">地接通</a>
                    </div> -->
                    <ul class="nav navbar-top-links navbar-right">
                        <li> <a href="#"><i class="fa fa-user"></i> #{$sys_account}#</a></li>
                        <li>
                            <a href="http://sdtanyue.com/dist/#/company/quotation/list" target="_blank"><i class="fa fa-share-square"></i>报价查询
                            </a>
                        </li>
                        <!-- <li><a href="http://www.07fly.top/index/lists/index/tid/35.html" target="_blank">
                                <i class="fa fa-hand-o-right"></i>技术支持</a></li> -->
                        <li>
                            <a class="J_menuItem" href="#{$smarty.const.ACT}#/sysmanage/Sys/sys_password_modify/">
                                <i class="fa fa-key"></i> 修改密码
                            </a>
                        </li>
                        <li>
                            <a class="count-info" href="#{$smarty.const.ACT}#/sysmanage/Login/logout/">
                                <i class="fa fa-sign-out"></i>退出
                            </a>
                        </li>
                    </ul>
                </nav>
            </div>
            <div class="row J_mainContent" id="content-main">
                <iframe name="J_iframe" id="J_iframe" width="100%" height="100%" src="" frameborder="0"
                    data-id="#{$smarty.const.ACT}#/sysmanage/Index/index/" seamless></iframe>
            </div>
        </div>
        <!--右侧部分结束-->
    </div>

    <!-- 全局js -->
    <script src="#{$smarty.const.APP}#/View/template/js/jquery.min.js?v=2.1.4"></script>
    <script src="#{$smarty.const.APP}#/View/template/js/jquery.cookie.js"></script>
    <script src="#{$smarty.const.APP}#/View/template/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="#{$smarty.const.APP}#/View/template/js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="#{$smarty.const.APP}#/View/template/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
    <script src="#{$smarty.const.APP}#/View/template/js/plugins/layer/layer.min.js"></script>
    <!-- 自定义js -->
    <script src="#{$smarty.const.APP}#/View/template/js/hAdmin.js?v=4.1.0"></script>
    <script type="text/javascript" src="#{$smarty.const.APP}#/View/template/js/index.js"></script>
    <!-- 第三方插件 -->
    <script src="#{$smarty.const.APP}#/View/template/js/plugins/pace/pace.min.js"></script>
    <!-- Toastr script -->
    <script src="#{$smarty.const.APP}#/View/template/js/plugins/toastr/toastr.min.js"></script>
    <script>
        $(document).ready(function () {
            var iframeUrl = localStorage.getItem('iframeUrl');
            if (typeof (iframeUrl) != "undefined" && iframeUrl != null) {

            } else {
                iframeUrl = '#{$smarty.const.ACT}#/sysmanage/Index/index/';
            }
            document.onkeypress = function (e) {
                if (e.keyCode == 116) {
                    e.preventDefault(); //组织默认刷新
                    iframe.src = iframeUrl;
                }
            }

            //刷新时设置当前点击页面数据
            if (typeof (iframeUrl) != "undefined") {
                that = $("a[href='" + iframeUrl + "']");
                //that.parent('li').addClass('active');
                that.parents('ul.nav').addClass('in');
                that.parents('ul.nav').parent('li').addClass('active');
                $('#J_iframe').attr('src', iframeUrl);//重新设置获取的url，实现刷新显示当前页面
            }

            //保存点击
            $(".J_menuItem").on('click', function () {
                var itemUrl = $(this).attr('href');
                console.log(iframeUrl);
                localStorage.setItem('iframeUrl', itemUrl);
            });

        });


        //声音播放插件
        var playSound = function () {
            var borswer = window.navigator.userAgent.toLowerCase();
            if (borswer.indexOf("ie") >= 0) {
                //IE内核浏览器
                var strEmbed = '<embed name="embedPlay" src="/upload/message.mp3" autostart="true" hidden="true" loop="false"></embed>';
                if ($("body").find("embed").length <= 0)
                    $("body").append(strEmbed);
                var embed = document.embedPlay;

                //浏览器不支持 audion，则使用 embed 播放
                embed.volume = 100;
                //embed.play();这个不需要
            } else {
                //非IE内核浏览器
                var strAudio = "<audio id='audioPlay' src='/upload/message.mp3' hidden='true'>";

                if ($("#audioPlay").length <= 0) {
                    $("body").append(strAudio);
                }
                var audio = document.getElementById("audioPlay");
                //浏览器支持 audio
                audio.play();
            }
        }

        //调用计划任务执行程序
        var cron_notice = function () {
            $.ajax({
                type: 'POST',
                url: '#{$smarty.const.ACT}#/sysmanage/Notice/notice_cron_json/',
                data: { "status": "-1" },
                dataType: 'json',
                success: function (data) {
                    $(data.list).each(function (index, item) {
                        //index指下标
                        //item指代对应元素内容
                        //this指代每一个元素对象
                        playNotice(item.id, item.title, item.content);
                        //console.log(item);
                        //console.log($(this));
                    });
                    // console.log(JSON.stringify(data));
                }
            });
        }
        //提示通知插件
        var playNotice = function (id, title, content) {
            toastr.options = {
                "closeButton": true,
                "debug": false,
                "progressBar": true,
                "onclick": null,
                "positionClass": "toast-bottom-right",
                "showDuration": "400",
                "hideDuration": "1000",
                "timeOut": "10000",//消失时间
                "extendedTimeOut": "1000",
                "showEasing": "swing",
                "hideEasing": "linear",
                "showMethod": "fadeIn",
                "hideMethod": "fadeOut"
            }
            toastr.options.onclick = function () {
                layer.open({
                    type: 2,
                    title: '查看通知',
                    shadeClose: true,
                    fixed: false, //不固定
                    area: ['90%', '90%'],
                    content: '#{$smarty.const.ACT}#/sysmanage/Notice/notice_view/notice_id/' + id + '/'
                });
            };
            toastr.info(content, title);
        }
        //提示通知插件
        var playMessage = function () {
            $.ajax({
                type: 'POST',
                url: '#{$smarty.const.ACT}#/sysmanage/Message/message_cron_json/',
                data: { "status": "-1" },
                dataType: 'json',
                success: function (data) {
                    // console.log(data);
                    if (data.list.length > 0) {
                        parent.layer.open({
                            type: 2,
                            title: false,
                            shade: 0,
                            area: ['350px', '250px'],
                            offset: 'rb', //右下角弹出
                            // time: 10000, //10000毫秒后自动关闭
                            shift: 2,
                            anim: 4,
                            content: ['#{$smarty.const.ACT}#/sysmanage/Message/message_show_cron/', 'yes'], //iframe的url，no代表不显示滚动条
                            end: function () {
                            }
                        });
                        playSound();
                    }
                }
            });
        }
        //主动调用
        //setInterval("func()", 60000);
        // setInterval("cron_notice()", 20000);//定时调用时间
        // setInterval("playMessage()", 600000);
        cron_notice();
        playMessage();
    </script>
</body>

</html>